<?php
	$row = $result[0];
	if($num_lang > 1)   $row_en = $result[1];
	   
	    echo form_open_multipart("admin/gallery/update/$catID/".$row['gallery_id']); ?>	<!-- start title -->
		<div class="title corners_top" style="float:left;width:600px;">
        	<h6 style="color:#900;" id="forms">
        		CẬp nhật hình ảnh <span style="color:#F00"><?php echo $namecat?></span>
        	</h6>
        </div><!-- end title -->
        		<div class="proccess_bar">
    <ul class="menu_bar">
    <li><?php
	$data = array('name' => 'update', 'value' => ' ','class'=>'delete-1', 'id' => 'save');
	 echo form_submit($data);?> <!--<a href="#" ><span class="save-1"> </span>Save</a> -->
     Lưu
     </li>
	
     <li> <?php 
	 $data = array('name' => 'close', 'value' => ' ','class'=>'delete-1', 'id' => 'cancel');
	 echo form_submit($data); ?>
     Hủy<!--<a href="#" ><span class="cancel-1"></span>Cancel</a>--></li>
    
    </ul>
 </div>
<div class="content">
       <div class="form" >
			<?php 
 				if(isset($missing) && is_array($missing) )
   				{
   					echo ' <div><a href="javascript:();" title="Succes box" class="box error corners"><span class="close">&nbsp;</span>';
   					foreach($missing as $item)
   						echo $item."<br />";
   					echo "</a></div>";
   				}
				$code = "img";
				$label =$this->lang->line('image');
			?>
			<p>
   				<h6 style="float:left;width:130px;" >Mới  &nbsp; &nbsp; &nbsp;</h6><input style="height:25px;" type="checkbox" name="new" <?php echo ($row['gallery_new'] == 1) ? 'checked="checked"':'' ;?> value="1" />
			</p>
            
    		<p>
     			<h6 class="t_float" style="clear:left"><?php echo 	$label =$this->lang->line('image'); ?></h6>
     			<div class="images">
					<input type="text" id="fileName" class="file_input_textbox corners_left" readonly="readonly" />
 					<div class="file_input_div">
					<input type="button" value="" class="file_input_button" />
					<input type="file" name="img" id="img" class="file_input_hidden" onchange="javascript: document.getElementById('fileName').value = this.value" />
				</div>
	</div>
         <?php if($row['gallery_image'] != "") {?> 
         		<img width="120" src="<?php echo base_url()?>upload/gallery/<?php echo $row['gallery_image']?>" />   
                <span> 
                	<a href="<?php echo base_url()."index.php/admin/gallery/del_image/$catID/".$row['gallery_id'];?>" style="color:#900;font-weight:bold" >Xóa Hinh </a>
                </span>
         
          <?php }?>
	</p>     
         
  <!-- Giá 

	<p>
		<?php
            
            $code = "price";
            $label ="Vietnamese";
            echo '<h6 class="t_float2">Giá</h6>';	
            $data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code,'value' => $row['gallery_price']);
                if (! empty($missing) && array_key_exists($code, $missing))
        
                 echo form_input($data, set_value($code)),'<span class="info_error">error</span>';
        
            else
              echo  form_input($data, set_value($code));
        ?>
	</p> 
    -->
	<p>
		<h6><?php echo $this->lang->line('news_title'); ?></h6>
		<?php
		echo '<div class="inner">';
			$code = "title_vi";
			$label ="Vietnamese".' <font color="red" style="font-weight:bold">(*)</font>';
			$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code, 'value' =>html_entity_decode($row['gallery_name'],ENT_QUOTES,'UTF-8'));
			echo '<div  class="t_float2">',($label),'</div>';
			if (! empty($missing) && array_key_exists($code, $missing))
				echo form_input($data, set_value($code)),'<span class="info_error">error</span>';
			else
				echo form_input($data, set_value($code));
			echo '</div>';
			if($num_lang > 1){
				echo '<div class="inner">';
			$code = "title_en";
			$label ="English".' <font color="red" style="font-weight:bold">(*)</font>';
			echo '<div  class="t_float2">',($label),'</div>';		
			$data = array('name' =>$code,'class'=>'large_input corners',  'value' => html_entity_decode($row_en['gallery_name'],ENT_QUOTES,'UTF-8'));
			if (! empty($missing) && array_key_exists($code, $missing))
				echo form_input($data, set_value($code)),'<span class="info_error">error</span>';
			else
				echo form_input($data, set_value($code));
		echo '</div>';
	}
?>
</p>
<h6 class="t_float" > Trạng thái </h6>
<div class="float radio"><input  type="radio" name="status" id="status" value="1" <?php echo ($row['gallery_status']== 1) ?  'checked="checked"' :  '';    ?> />Hiện
<input  type="radio" name="status" id="status" value="0 " <?php  echo($row['gallery_status']!= 1) ?  'checked="checked"':  ''; ?> /> ẩn

</div>
<!--
<p>
<h6>Chi tiết</h6> 
<?php

			//direction vietname
$code = "direction_vi";
	$label ="Vietnamese";
	echo '<p>';
	echo '<div class="t_float2"> '.$label.'</div>';
	echo '<div class="float">';
	$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code, 'value' =>  html_entity_decode($row['gallery_content'],ENT_QUOTES,'UTF-8'));

	echo '<div class="textarea"> '.form_textarea($data).'</div>';

	echo '</div>';
echo '</p>';	
		if($num_lang > 1)  
		{
	
		//direction english
$code = "direction_en";
	$label ="English";
	echo '<div class="t_float2"> '.$label.'</div>';
	echo '<div class="float">';

	$data = array('name' =>$code, 'id' => $code,'class'=>'large_input corners', 'value' => html_entity_decode( $row_en['gallery_content'],ENT_QUOTES,'UTF-8'));

	echo '<div class="textarea">'.form_textarea($data).'</div>';

	echo '</div>';
		}
?>
</p>
<?php
	echo form_close(); //FORM END
?> 
     </div>
     </div>   
     

<script type="text/javascript">

// This is a check for the CKEditor class. If not defined, the paths must be checked.
if ( typeof CKEDITOR == 'undefined' )
{
	document.write(
		'<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
		'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
		'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
		'this file, changing the wrong paths in the &lt;head&gt; (line 5) and the "BasePath"' +
		'value (line 32).' ) ;
}
else
{

	var editor =		CKEDITOR.replace("direction_vi");
	<?php  if($num_lang >1) echo 'var editor2 = CKEDITOR.replace("direction_en");'?>

	//editor.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	//editor2.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	//editor3.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	// Just call CKFinder.SetupCKEditor and pass the CKEditor instance as the first argument.
	// The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
	CKFinder.setupCKEditor( editor,'<?php echo base_url(); ?>public/scripts/admin/ckfinder') ;  //'../../../../../public/scripts/admin/ckfinder') ;
<?php  if($num_lang >1) echo "CKFinder.setupCKEditor( editor, '".base_url()."public/scripts/admin/ckfinder') ;"?>
	// It is also possible to pass an object with selected CKFinder properties as a second argument.
	// CKFinder.SetupCKEditor( editor, { BasePath : '../../', RememberLastFolder : false } ) ;
}

		</script>
-->
